export const localStorage = {
  set(key, val) {
    window.localStorage.setItem(key, JSON.stringify(val));
  }, get(key) {
    const json = window.localStorage.getItem(key);
    return JSON.parse(json);
  }, remove(key) {
    window.localStorage.removeItem(key);
  }, clear() {
    window.localStorage.clear();
  },
};

export const sessionStorage = {
  set(key, val) {
    window.sessionStorage.setItem(key, JSON.stringify(val));
  }, get(key) {
    const json = window.sessionStorage.getItem(key);
    return JSON.parse(json);
  }, remove(key) {
    window.sessionStorage.removeItem(key);
  }, clear() {
    window.sessionStorage.clear();
  },
};
